package com.cjm.one.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cjm.one.common.result.Result;
import com.cjm.one.goods.client.GoodsCommentClient;
import com.cjm.one.model.goods.dto.GoodsCommentDto;
import com.cjm.one.model.goods.entity.GoodsComment;
import com.cjm.one.model.goods.entity.GoodsCommentTag;
import com.cjm.one.model.goods.vo.GoodsCommentCountVo;
import com.cjm.one.model.goods.vo.GoodsCommentTagVo;
import com.cjm.one.model.goods.vo.GoodsCommentVo;
import com.cjm.one.service.GoodsCommentService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsCommentServiceImpl implements GoodsCommentService {
    @Resource
    private GoodsCommentClient goodsCommentClient;

    @Override
    public Result<Page<GoodsCommentVo>> listPageByGoodsId(Integer current, Integer size, Long goodsId, String sortOrder, List<Long> tagIds) {
        return goodsCommentClient.list(current, size, goodsId, sortOrder, tagIds);
    }

    @Override
    public Result<GoodsCommentCountVo> getTagByGoodsId(Long id) {
        return goodsCommentClient.getTagById(id);
    }

    @Override
    public Result<List<GoodsComment>> getTopComments(Long goodsId) {
        return goodsCommentClient.getTopComments(goodsId);
    }

    @Override
    public Result<List<GoodsCommentTag>> getTags() {
        return goodsCommentClient.getTags();
    }

    @Override
    public Result<Boolean> saveGoodsComment(List<GoodsCommentDto> goodsCommentDto) {
        return goodsCommentClient.save(goodsCommentDto);
    }
}
